﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using RuleCode.Table;

namespace map.member.order
{
    public partial class sell_1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bind1();
            }
        }
        private void bind1()
        { 
            taobaotrade t = taobaotrade.Find(" seller_nick = '"
                + AliApi.appUserId+"' and taobaostatus = '"+TRADE_STATUS .Buyer_Order +"'");
            WebPager1.DataSource = t.MyTable;
            WebPager1.DataBind();
        }

        protected void WebPager1_PageIndexChanged(object sender, RuleCode.Controls.PageChangedEventArgs e)
        {
            WebPager1.CurrentPageIndex = e.NewPageIndex;
            bind1();
        }

        //protected void ConfirmOrderButton_Click(object sender, EventArgs e)
        //{
        //    if (AliApi.appUserId != string.Empty)
        //    {
        //        taobaotrade trade = taobaotrade.Find("seller_nick='"+AliApi.appUserId +"'");
        //        if (trade.Count > 0)
        //        {
        //            for (int i = 0; i < this.GridView1.Rows.Count; i++)
        //            {
        //                CheckBox checkbox = GridView1.Rows[i].FindControl("SelectItemCheckBox") as CheckBox;
        //                if (checkbox.Checked)
        //                {
        //                    int index = trade.IndexOf ("recid="+GridView1 .DataKeys [i]["RECID"].ToString ());
        //                    if (index >= 0)
        //                    {
        //                        trade.CurrentIndex = index;
        //                        trade.taobaostatus.Value = TRADE_STATUS .Seller_ConfirmOrder ;
        //                        trade.Modify();
        //                    }                                
        //                }
        //            }
        //            bind1();
        //        }
        //    }
        //}

        //protected void SelectOtherCheckBox_CheckedChanged(object sender, EventArgs e)
        //{
        //    for (int i = 0; i < this.GridView1.Rows.Count; i++)
        //    {
        //        CheckBox checkbox = GridView1.Rows[i].FindControl("SelectItemCheckBox") as CheckBox;
        //        checkbox.Checked = !checkbox.Checked;
        //    }
        //    SelectAllCheckBox.Checked = false;
        //}

        //protected void SelectAllCheckBox_CheckedChanged(object sender, EventArgs e)
        //{
        //    for (int i = 0; i < this.GridView1.Rows.Count; i++)
        //    {
        //        CheckBox checkbox = GridView1.Rows[i].FindControl("SelectItemCheckBox") as CheckBox;
        //        checkbox.Checked = SelectAllCheckBox.Checked;
        //    }
        //    SelectOtherCheckBox.Checked = false;
        //}
    }
}
